package no.evalanche.logic;

import java.util.Vector;

import org.json.JSONArray;
import org.json.JSONException;
/**
 * 
 * 
 * Contains all details about a challenge
 *@author vholms
 */
public class AChallenge {
	
	private String theChallenge = null;
	private Vector<String> theChoices = new Vector<String>();
	private String theTablekey = null;
	private String answer = "dummy";
		
	public String getAnswer() {
		return answer;
	}



	public AChallenge(String theChallenge, JSONArray jsonArray,
			String theTablekey, String answer) {
		super();
		this.answer = answer;
		this.theChallenge = theChallenge;
		for (int n=0; n<jsonArray.length();n++) {
			try {
				theChoices.add(jsonArray.get(n).toString());
			} catch (JSONException e) {
				e.printStackTrace();
			}
		}	
		this.theTablekey = theTablekey;
	}



	public String getChallenge() {
		return theChallenge;
	}



	public Vector<String> getALternatives() {
		return theChoices;
	}



	public String getSolutionPK() {
		return theTablekey;
	}



	public boolean is(String clickedChoice) {
		return clickedChoice.equals(answer);
	}
	
	
	

}
